/* Copyright 2009 (c) ENSI de Bourges
 * 		88 boulevard Lahitolle, 18020 Bourges Cedex, France
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/**
 * \file log-player.c
 * \brief Source code for functions related to the log player's GUI
 * \author Steve Dodier <sidnioulz@gmail.com>
 *
 * This file contains the declaration of functions used by the log player's GUI.
 */
#include <gtk/gtk.h>

#include "log-player.h"



void toggle_player_panel (GtkToolButton *button, gpointer *user_data)
{
	GtkBuilder 	*builder 	= (GtkBuilder *) user_data;
	GtkWidget 	*panel		= (GtkWidget *) gtk_builder_get_object (builder, "top_panel");
	GtkWidget 	*top_box	= (GtkWidget *) gtk_builder_get_object (builder, "top_box");
	GtkWidget 	*frame_box	= (GtkWidget *) gtk_builder_get_object (builder, "scroll_area");

	if (gtk_widget_get_parent (frame_box) == panel) {
		g_object_ref (panel);
		g_object_ref (frame_box);
		gtk_container_remove (GTK_CONTAINER (panel), frame_box);
		gtk_container_remove (GTK_CONTAINER (top_box), panel);
		gtk_container_add (GTK_CONTAINER (top_box), frame_box);
		g_object_unref (frame_box);
	} else {
		g_object_ref (frame_box);
		gtk_container_remove (GTK_CONTAINER (top_box), frame_box);
		gtk_container_add (GTK_CONTAINER (top_box), panel);
		gtk_paned_add2 (GTK_PANED (panel), frame_box);
		g_object_unref (frame_box);
	}
}
